import { validatePhone, validatePassword } from '@/utils/validate'
const rule = {
  userName: [{ required: true, message: '用户账号不能为空', trigger: 'blur' }],
  deptId: [{ required: true, message: '归属部门不能为空', trigger: 'blur' }],
  nickName: [{ required: true, message: '用户姓名不能为空', trigger: 'blur' }],
  password: [
    { required: true, message: '用户密码不能为空', trigger: 'blur' },
    {
      validator: validatePassword,
      trigger: ['blur'],
      message: `密码格式：8～20位，必须包含字母、数字、特殊符号，并区分大小写!`,
    },
  ],

  phonenumber: [
    {
      maxlength: '11',
      validator: validatePhone,
      message: `手机号最大长度为11位!`,
      trigger: ['blur'],
    },
  ],
  linephone: [
    {
      maxlength: '10',
      message: `座机号码号最大长度为10位!`,
      trigger: ['blur'],
    },
  ],
  email: [
    {
      type: 'email',
      message: `请输入正确的邮箱格式!`,
      trigger: ['blur'],
    },
  ],
}

export { rule }
